stage.set_background("schoolentrance")
stage.wait(2)
stage.create_grid_overlay(50, "blue")
stage.set_background_color("azure")
emma = codesters.Sprite("person1")
emma.set_size(0.5)
michael = codesters.Sprite("person2")
michael.set_size(0.5)
emma_x = random.randint(-230,230)
emma_y = random.randint(-230,230)
emma.go_to(emma_x, emma_y)
michael_x = random.randint(-230,230)
michael_y = random.randint(-230,230)
michael.go_to(michael_x, michael_y)
delta_x = emma_x - michael_x
t = codesters.Teacher()
deltay = t.find_text("delta_y")
try:
tval1 = deltay[0][1].replace(" ", "")
except:
tval1 = "DNE"
t1 = TestObjective()
t1.add_success(tval1 == "delta_y=emma_y-michael_y" , "Great Job!")
t1.add_failure(tval1 == "DNE", "Did you drag out a Delta Y tool?")
t1.add_failure(tval1 == "delta_y=michael_y-emma_y", "Whoops! You reversed netx and ballx!")
t1.add_failure("-" not in tval1, "Did you drag out a Delta Y tool?")
t1.add_failure("emma_y" not in tval1, "Did you change y2 to emma_y?")
t1.add_failure("michael_y" not in tval1, "Did you change the y1 to michael_y")
tester = TestManager()
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)